<?php
/**
 * @author spenceryg
 * @date 2022/11/25
 * @time 1:28 下午
 * @focus love & life
 */

namespace app\admin\controller\sys\model;

use think\model\relation\BelongsToMany;

class AdminRoleModel extends \think\Model
{
    protected $name = 'admin_role';
    protected $table = 'db_admin_role';

    /**
     * 关联模型 adminAccess
     * @return BelongsToMany
     */
    public function adminAccess(): BelongsToMany
    {
        return $this->belongsToMany(AdminAccessModel::class, 'admin_role_access', 'admin_access_id', 'admin_role_id');
    }


    /**
     * 关联模型 adminNode
     * @return BelongsToMany
     */
    public function adminNode(): BelongsToMany
    {
        return $this->belongsToMany(AdminNodeModel::class, 'admin_role_node', 'admin_role_id', 'admin_role_id');
    }
}
